<template>
	<view>
		<view class="mt-5" v-if="u_loadmore">
			<u-loadmore status="loading" icon-type="circle" />
		</view>
		<view v-else>
			<radio-group>
				<view class="m-2 pl-3 py-4 bg-white rounded-20" v-for="(item,index) in appointList" :key="index" @click="change(item)">
					<view class="d-flex a-center">
						<view>
							<radio color="#F24F4A"   :checked="item.is_checked"  />
						</view>
						<view class="">
							<view class="d-flex font-weight">
								<view class="text-danger">{{item.store_name}}</view>
								<view class="ml-1">{{item.mobile}}</view>
							</view>
							<view class="text-muted pt-1">{{item.store_address}}</view>
						</view>
					</view>
				</view>		
			</radio-group>
			<view class="bg-white py-2 w-100 position-fixed bottom-0 btn">
				<button type="warn" @click="order_appoint()">指派发货</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				appointList:"", // 指派订单列表
				order_id:"", // 订单ID
				store_id:"", // 库存ID
				u_loadmore:true, // 加载中
			}
		},
		methods: {
			change(item){
				this.store_id=item.store_id
			},
			// 指派发货
			order_appoint(){
				this.$H.post("admin/order/operate/setgrab",{order_id:this.order_id,store_id:this.store_id}).then(res=>{
					console.log(res)
					uni.navigateBack({
						delta:2
					})
				})
			}
		},
		onLoad(e) {
			this.order_id=e.order_id
			this.$H.post("admin/order/store/list",{order_id:this.order_id}).then(res=>{
				this.appointList=res.data
				this.u_loadmore=false 
			})
		}
	}
</script>

<style>
	.btn /deep/ button{
		width: 85%;
		border-radius: 50upx;
		background: linear-gradient(to right,#F31E3E,#FB4F37);
	}
</style>
